package com.zjw.mp.demo.service;

import com.zjw.mp.demo.mapper.BookMapper;
import com.zjw.mp.demo.pojo.Books;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author:zhaojiawei
 * @Date: 2023/3/20 16:03
 */
@Service
public class BookSerivce {

    @Autowired
    private BookMapper mapper;


    public void selectBooks(){
        val books = mapper.selectList(null);

        books.forEach(System.out::println);
    }

    public boolean insert(Books books){

        int result = mapper.insert(books);
        System.out.println(result);
        return true;
    }

    public int updateById(Books books){

        int res = mapper.updateById(books);

        return res;
    }
}
